Meteor Landings Notebook

Gowri, Wed 12 August 2020, Space

nasa

In this post, I will analyze meteor landings throughout the world and take my first steps towards my goal of using astronomy and computer science to explore the mysteries of the universe!

The data for this project comes from NASA's open data portal - Nasa Meteorite Landings. This is an amazing treasure trove of information for space buffs directly from NASA.

In order to map these sites of meteor landings in Python, I will use the Folium module. Folium is a popular python library used to visualize geospatial data and create interactive maps.

First, lets load the Python modules that will be needed for this project. These include Pandas, Folium, Matplotlib, Math and Geopandas.

In [1]:
from folium.plugins import MarkerCluster
import pandas as pd
import folium
import matplotlib.pyplot as plt
import math
import geopandas

Download the Meteorite Landings csv file from this link -> Nasa Meteorite Landings

The next step is to read the csv file and see its structure. (Adjust the path name according to where you have downloaded the csv)

In [2]:
meteors_raw_data = pd.read_csv("../data/Meteorite_Landings.csv")
meteors_raw_data.head()
Out[2]:
name id nametype recclass mass (g) fall year reclat reclong GeoLocation
0 Aachen 1 Valid L5 21.0 Fell 01/01/1880 12:00:00 AM 50.77500 6.08333 (50.775, 6.08333)
1 Aarhus 2 Valid H6 720.0 Fell 01/01/1951 12:00:00 AM 56.18333 10.23333 (56.18333, 10.23333)
2 Abee 6 Valid EH4 107000.0 Fell 01/01/1952 12:00:00 AM 54.21667 -113.00000 (54.21667, -113.0)
3 Acapulco 10 Valid Acapulcoite 1914.0 Fell 01/01/1976 12:00:00 AM 16.88333 -99.90000 (16.88333, -99.9)
4 Achiras 370 Valid L6 780.0 Fell 01/01/1902 12:00:00 AM -33.16667 -64.95000 (-33.16667, -64.95)

This dataset contains the meteor name, mass, year and geographic coordinates. Let's clean up the data and plot it on a map using their latitudes and longitudes.

The rows containg null or missing values for latitude and longitude are dropped and the result is plotted on a map.

As there are over 47,000 meteor landing points, plotting them together wil cause clutter on the map. So, I use a feature of Folium to cluster the points based on geography. Upon clicking the cluster, we can zoom in and view the meteor details individually.

In [3]:
meteors = meteors_raw_data.dropna(subset=["reclong", "reclat"]).drop_duplicates(subset=["reclong", "reclat"])
map = folium.Map(tiles='cartodbpositron', zoom_start=30)
marker_cluster = MarkerCluster().add_to(map)

for index, row in meteors.iterrows():
    name = row["name"]
    year = str(row["year"])
    latitude = row['reclat']
    longitude = row['reclong']

    popup_text = '<h3 style="color:green;">' + name + '</h3>'
    if year.lower() != "nan":
        popup_text = popup_text + year
    
    folium.Marker(location = [latitude, longitude], tooltip = popup_text).add_to(marker_cluster)
map
Out[3]:
Make this Notebook Trusted to load map: File -> Trust Notebook

Run the code below at your own risk! As there are more than 45,700 meteors in the data set, plotting them all together results in a cluttered and unreadable map.Also, Folium being a wrapper in python for Leaflet.js is unable to process a huge dataset and plot it dynamically.

In [4]:
# map = folium.Map(tiles='cartodbpositron', zoom_start=30)

# for index, row in meteors.iterrows():
#     name = row["name"]
#     year = str(row["year"])
#     latitude = row['reclat']
#     longitude = row['reclong']

#     popup_text = '<h3 style="color:green;">' + name + '</h3>'
#     if year.lower() != "nan":
#         popup_text = popup_text + year
    
#     folium.Marker(location = [latitude, longitude], tooltip = popup_text).add_to(map)
# map